var mongoose = require('../dao/mongo/mongo');

var Schema = mongoose.Schema;

var moneyLogSchema = new Schema({
    id: {
        type: String,
    },
    uid: {
        type: String,
        index: true,
    },
    // 增加的金钱
    increase_money: {
        type: Number
    },
    // 金钱总量
    total_money: {
        type: Number,
        default: 0
    },
    // 当前金钱
    money: {
        type: Number,
        default: 0
    },
    //操作类型 add增加 sub减少
    operate: {
        type: String,
        default: "add"
    },
    //修改途径
    type: {
        type: String,
        default: "",
        index: true
    },
    time: {
        type: String,
        default: new Date(new Date().toLocaleDateString()).getTime()
    },
    gmt_create: {
        type: Number,
    },
    gmt_modified: {
        type: Number,
    }
}, {
    collection: "moneyLogs"
})

module.exports = mongoose.model('moneyLog', moneyLogSchema);
